package io.renren.minimito.controller;

import java.util.Arrays;
import java.util.Map;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import io.renren.minimito.entity.SqTopicReplayEntity;
import io.renren.minimito.service.SqTopicReplayService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;




/**
 * 
 *
 * @author nomito
 * @email 1790464356@qq.com
 * @date 2021-05-10 09:02:11
 */
@Api(tags = "sqtopicreplay")
@RestController
@RequestMapping("minimito/sqtopicreplay")
public class SqTopicReplayController {
    @Autowired
    private SqTopicReplayService sqTopicReplayService;

    /**
     * 列表
     */
    @ApiOperation(value = "基础列表查询")
    @ApiImplicitParam(name = "params",value = "聚合查询参数",required = false)
    @GetMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = sqTopicReplayService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @ApiOperation(value = "基础id详情")
    @GetMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
		SqTopicReplayEntity sqTopicReplay = sqTopicReplayService.getById(id);

        return R.ok().put("sqTopicReplay", sqTopicReplay);
    }

    /**
     * 保存
     */
    @ApiOperation(value = "基础保存")
    @PostMapping("/save")
    public R save(@RequestBody SqTopicReplayEntity sqTopicReplay){
		sqTopicReplayService.save(sqTopicReplay);

        return R.ok();
    }

    /**
     * 修改
     */
    @ApiOperation(value = "基础修改")
    @PostMapping("/update")
    public R update(@RequestBody SqTopicReplayEntity sqTopicReplay){
		sqTopicReplayService.updateById(sqTopicReplay);

        return R.ok();
    }

    /**
     * 删除
     */
    @ApiOperation(value = "基础删除")
    @PostMapping("/delete")
    public R delete(@RequestBody Long[] ids){
		sqTopicReplayService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
